using UnityEditor;

namespace XFramework
{
    [InitializeOnLoad]
    public class CodeControllerTemplate : ICodeGenTemplate
    {
        static CodeControllerTemplate()
        {
            CodeGen.RegisterTemplate(nameof(CodeController), new CodeControllerTemplate());
        }

        public CodeGenTask CreateTask(IBindGroup bindGroup)
        {
            var cv = bindGroup as CodeController;
            return new CodeGenTask()
            {
                ScriptsFolder = cv.ScriptsFolder,
                GameObject = cv.gameObject,
                Namespace = cv.Namespace,
                BaseName = cv.BaseName,
                ClassName = cv.ScriptName,
            };
        }
    }
}